@import "./common/mixin.scss";
@import "./common/utils.scss";
@import "./common/vars.scss";

@include module(select) {
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
  position: relative;
  .as-input {
    width: inherit;
  }
  .suffix-icon {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    padding: 4px;
    color: mix($--color-white, $--color-text-regular, 30%);
  }

  @include module(input) {
    pointer-events: none;
  }

  @include modifier(small) {
    width: 160px;
  }
  @include modifier(mini) {
    width: 150px;
  }

  @include when(disabled) {
    cursor: not-allowed;
    .suffix-icon {
      color: mix(
        $--color-white,
        $--color-text-regular,
        $--color-disabled-percent
      );
    }
  }
}

@include module(select-dropdown) {
  transform-origin: top;
  max-height: 200px;
  overflow: auto;
  z-index: 100;
  background: white;
  position: absolute;
  top: 30px;
  margin: 12px 0 5px 0;
  border-radius: $--border-radius-base;
  padding: 6px 0;
  box-sizing: border-box;
  min-width: 20px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  cursor: auto;
  border: solid 1px mix($--color-white, $--border-color-base, 70%);
  @include modifier(small) {
    top: 22px;
  }
  @include modifier(mini) {
    top: 18px;
  }
  @include modifier(top) {
    transform-origin: bottom;
    margin: 5px 0 42px 0;
    bottom: 0;
    top: unset;

    &.as-select-dropdown--small {
      margin: 5px 0 34px 0;
    }

    &.as-select-dropdown--mini {
      margin: 5px 0 30px 0;
    }
  }
}

@include module(option) {
  white-space: nowrap;
  cursor: pointer;
  padding: 0 20px;
  height: 34px;
  background: white;
  color: $--color-text-regular;
  font-size: $--font-size-base;
  line-height: 34px;
  outline: none;
  @include utils-user-select(none);
  @include when(hover) {
    background: mix($--color-white, $--color-primary, 92%);
  }

  @include modifier(small) {
    line-height: 30px;
    height: 30px;
    font-size: $--font-size-small;
  }

  @include modifier(mini) {
    line-height: 28px;
    height: 28px;
    font-size: $--font-size-extra-small;
  }

  @include when(active) {
    color: $--color-primary;
    font-weight: bold;
  }

  @include when(disabled) {
    cursor: not-allowed;
    background: mix($--color-black, $--color-white, 5%);
    color: mix($--color-white, $--color-text-regular, 20%);
  }
}
